package com.crm.service.impl.sys.permissionManagement;

import com.crm.dao.mapper.customMapper.sys.CompanyProjectCustomMapper;
import com.crm.dao.mapper.sys.permissionManagement.SysCompanyProjectMapper;
import com.crm.model.entity.sys.permissionManagement.SysCompanyProject;
import com.crm.model.vo.sys.CompanyProjectVO;
import com.crm.service.sys.permissionManagement.CompanyProjectDbService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * @Author:chaifuyou
 * @Date: 2021/7/27 9:19
 */
@Service
public class CompanyProjectDbServiceImpl implements CompanyProjectDbService {

    @Autowired
    private CompanyProjectCustomMapper companyProjectCustomMapper;

    @Autowired
    private SysCompanyProjectMapper sysCompanyProjectMapper;

    /**
     * 增加分公司项目
     * @param sysCompanyProject
     */
    @Override
    public void addCompanyProject(SysCompanyProject sysCompanyProject) {
        sysCompanyProjectMapper.insertSelective(sysCompanyProject);
    }

    /**
     * 查询分公司项目列表
     * @param companyName
     * @return
     */
    @Override
    public List<CompanyProjectVO> selectCompanyProjectList(String companyName,String companyId) {
        return companyProjectCustomMapper.selectCompanyProjectList(companyName,companyId);
    }

    /**
     * 修改项目
     * @param sysCompanyProject
     */
    @Override
    public void updateCompanyProject(SysCompanyProject sysCompanyProject) {
        sysCompanyProjectMapper.updateByPrimaryKeySelective(sysCompanyProject);
    }

    /**
     * 通过id查询项目信息
     * @param companyProjectId
     * @return
     */
    @Override
    public CompanyProjectVO selectCompanyProjectById(String companyProjectId) {
        return companyProjectCustomMapper.selectCompanyProjectById(companyProjectId);
    }
}
